<?php
    
        include('../confdb.php');

        $sud = $_POST['sud'] ?? '';
        $kol_sud = $_POST['kol_sud'] ?? '';
        $nomer_kort = $_POST['nomer_kort'] ?? '';
        $del = $_POST['del'] ?? '';
        $otkl = $_POST['otkl'] ?? '';
        $num = $_POST['num'] ?? '';
        $sys = $_POST['sys'] ?? '';

        $con = mysqli_connect($db_host, $db_user, $db_pass, $db_name);
        $query = "SELECT * FROM vistuplenie WHERE idvistuplenie = '1'";
        $result = mysqli_query($con, $query);
        $call = mysqli_num_rows($result);
        if ($call == null) {
            $query = "INSERT INTO vistuplenie (idvistuplenie, vistuplenie_nomer, vistuplenie_pokaz, vistuplenie_activno, vistuplenie_zaversheno, vistuplenie_sportsmen, phumse_idphumse, vistuplenie_kolsud, vistuplenie_sys, vistuplenie_kort) VALUES (1, 0, 0, 2, 2, 'Setting', 0, '$kol_sud', '$sys', '$kort')";
            $result = mysqli_query($con, $query) or die("Ошибка " . mysqli_error($con));
        } else {
            $upquery = "UPDATE vistuplenie SET vistuplenie_kolsud='$kol_sud', vistuplenie_sys='$sys', vistuplenie_kort='$kort' where idvistuplenie=1";
            $result = mysqli_query($con, $upquery) or die("Ошибка " . mysqli_error($con));
        }

        

?>

